package com.derbysoft.ota.application.translator.rs;

import java.util.List;

import javax.annotation.Nullable;

import com.derbysoft.modules.eip.translator.Translator;
import com.derbysoft.ota.interfaces.protocol._2009a.GuaranteeType;
import com.derbysoft.remote.dswitch.hotel.dto.AvailGuaranteeDTO;
import com.google.common.base.Function;
import com.googlecode.functionalcollections.FunctionalIterables;

public class GuaranteeTypeRSTranslator implements Translator<List<AvailGuaranteeDTO>, List<GuaranteeType>> {

	private static GuaranteeRSTranslator guaranteeRSTranslator = new GuaranteeRSTranslator();

	public List<GuaranteeType> translate(List<AvailGuaranteeDTO> source) {
		return FunctionalIterables.make(source).map(new Function<AvailGuaranteeDTO, GuaranteeType>() {
			public GuaranteeType apply(@Nullable AvailGuaranteeDTO from) {
				return guaranteeRSTranslator.translate(from);
			}
		}).uniq().toList();
	}
}
